<template>
  <div>
    <table id="app" width="50%" border="0" cellpadding="0" cellspacing="1">
      <input type="hidden" value="6" name="projectId"/>
      <input type="hidden" value="4" name="categoryid"/>
      <tbody>
      <tr>
        <td width="21%" bgcolor="#f3f3f3">
          <div align="right">项目名称</div>
        </td>
        <td width="2%" bgcolor="#f3f3f3">&nbsp;</td>
        <td width="77%" bgcolor="#f3f3f3">
          <div align="left">{{ project.projectName }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">申请单位</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.unitName }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">申请人</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.applicant }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">职称</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.grade }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">学历</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.education }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">填报时间</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.fillData }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">项目现状</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.status }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">项目前景</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.future }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">重难点分析</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.analysis }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">研究方法</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.way }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">预计研究成果</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.result }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">申请资金</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">{{ project.capital }}</div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">专家评审意见</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">
            <textarea id="opinion" name="expertOpinion" v-model="project.expertOpinion"></textarea>
          </div>
        </td>
      </tr>
      <tr>
        <td bgcolor="#f3f3f3">
          <div align="right">专家评分</div>
        </td>
        <td bgcolor="#f3f3f3">&nbsp;</td>
        <td bgcolor="#f3f3f3">
          <div align="left">
            <input id="score" name="score" v-model="project.score"/>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2" align="middle" bgcolor="#f3f3f3">&nbsp;</td>
        <td height="30" align="middle" bgcolor="#f3f3f3">
          <div align="left">
            <button @click="updateProject()">提交</button>
          </div>
        </td>
      </tr>
      </tbody>
    </table>
  </div>

</template>

<script>
import four from '../../util/four';

export default {
  name: "ProjectinfoView.vue",
  data() {
    return {
      project: {
        expertOpinion: "",
      },
    }
  },
  mounted() {
    this.getByPid();
  },
  methods: {
    getByPid() {
      //获取pid
      let pid = JSON.parse(sessionStorage.getItem("projectId"));
      //查询项目信息
      four.get("/projectManage/" + pid).then((res) => {
        this.project = res.data.data;
      })
    },
    updateProject() {
      four.put("/projectManage", this.project).then((res) => {
        if (res.data.code === 20031) {
          this.$message.success("审批成功！")
        }
        if (res.data.code === 20030) {
          this.$message.error("审批失败！")
        }
        //1秒后跳转页面
        setTimeout(function () {
          this.$router.push({
            path: 'expert/showproject'
          })
        }, 1000);
      })
    }
  }
}
</script>

<style scoped>

</style>